package com.linkhub.oms.data.sync.api.shopify.domain.response;

import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;

import java.io.Serializable;
import java.util.List;
import java.util.Objects;

@Data
@EqualsAndHashCode(callSuper = true)
@NoArgsConstructor
@AllArgsConstructor
public class FulfillmentResponse extends BaseResponse implements Serializable {

    public boolean success() {
        if (getFulfillment() == null) {
            return false;
        }
        return Objects.equals(SUCCESS_FLAG, getFulfillment().getStatus());
    }

    @Override
    public int count() {
        return 0;
    }

    @Override
    public String maxUpdateTime() {
        return "";
    }

    private Fulfillment fulfillment;

    @Data
    @NoArgsConstructor
    @AllArgsConstructor
    public static class Fulfillment {
        private long id;
        @JsonProperty("order_id")
        private long orderId;
        private String status;
        @JsonProperty("created_at")
        private String createdAt;
        private String service;
        @JsonProperty("updated_at")
        private String updatedAt;
        @JsonProperty("tracking_company")
        private String trackingCompany;
        @JsonProperty("shipment_status")
        private String shipmentStatus;
        @JsonProperty("location_id")
        private long locationId;
        @JsonProperty("origin_address")
        private String originAddress;
        @JsonProperty("tracking_number")
        private String trackingNumber;
        @JsonProperty("tracking_numbers")
        private List<String> trackingNumbers;
        @JsonProperty("tracking_url")
        private String trackingUrl;
        @JsonProperty("tracking_urls")
        private List<String> trackingUrls;
        private String name;
        @JsonProperty("admin_graphql_api_id")
        private String adminGraphqlApiId;
    }
}
